<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../../css/common/common.css" />
		<link rel="stylesheet" href="../../css/settings/Reading.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">我的朗读</h1>
		</header>
		<div class="main_seach">
			<div class="seach_inp">
				<div class="mui-icon mui-icon-search "></div>
				<input type="text" name="" class="seach_val" placeholder="请输入你想要搜索的笔记" />
			</div>
			<div class="seach_buttom">搜索</div>
		</div>
		<!-- 列表-->
		<div id="offCanvasContentScroll" class="mui-scroll-wrapper mui-content">
			<div class="mui-scroll">
				<div>
					<div class="list pullrefresh" v-for="list in list" :readingRecordUid="list.readingRecordUid">
						<div class="img_img">
						<img src="../../imges/jpimageshomeerrorimage.png"    v-lazy="list.picUrl" v-cloak />
						</div>
						<div class="shu">
							<div class="Title" v-text="list.caseName"></div>
							<p v-cloak>{{list.grade}}</p>
							<div class="total">
								<div class="commentCount"><img src="../../imges/Union 52.png" v-cloak></div>
								<span class="commentCount_text" v-cloak>{{list.totalLike}}</span>
							</div>
							<div class="total">
								<div class="commentCount"><img src="../../imges/Subtraction 87.png" v-cloak></div>
								<span class="commentCount_text" v-cloak>{{list.commentCount }}</span>
							</div>
						</div>
						<!-- 	评分-->
						<div class="score">
							<div class="zi_da" v-cloak>查看</div>
						</div>
					</div>
				</div>
			</div>
		</div>

		<script src="../../js/mui.min.js"></script>
		<script src="../../js/libs/zepto_1.1.3.js"></script>
		<script src="../../js/libs/vue.js"></script>
		<script src="../../js/libs/vue-lazyload.js"></script>
		<script src="../../js/common/common.js"></script>
		<script type="text/javascript">
			mui.init({
				pullRefresh: {
					container: '#offCanvasContentScroll',
					up: {
						contentrefresh: '正在加载...',
						callback: pullupRefresh
					}
				}
			});
			var reading = new Vue({
				el: ".mui-content",
				data: {
					list: []
				}
			})
			
			Vue.use(VueLazyload, {
	             preLoad: 1.3,
	             error: '../../imges/jpimageshomeerrorimage.png',
	             loading: '../../imges/jpimageshomeerrorimage.png'
                      });
			var temp = 1

			function pullupRefresh() {
				common.ajax('student/reading/queryMySelf', {
						uid: common.uid,
						token: common.token,
						page: temp++,
						keyword: $(".seach_val").val(),
						pageSize: 8 //多少页
					},
					function(data) {
						if(data.code == 200) {

							if(!data.data.hasNextPage) {
								mui('#offCanvasContentScroll').pullRefresh().endPullupToRefresh(true)
							} else {
								mui('#offCanvasContentScroll').pullRefresh().endPullupToRefresh()
							}
							for(var i = 0; i < data.data.list.length; i++) {
								reading.list.push(data.data.list[i])
							}
						} else {
							mui.toast(data.message)
						}
					}, 'get')
			}

			$(".seach_buttom").on("tap", function() {
				mui('#offCanvasContentScroll').pullRefresh().refresh(true);
				reading.list = []
				temp = 1
				shauxin()
				mui('#offCanvasContentScroll').pullRefresh().scrollTo(0, 0, 100);
			})
			$(".seach_val").on("input", function() {
				if($(".seach_val").val() == '') {
					mui('#offCanvasContentScroll').pullRefresh().refresh(true);
					reading.list = []
					temp = 1
					shauxin()
					mui('#offCanvasContentScroll').pullRefresh().scrollTo(0, 0, 100);
				}
			})

			shauxin()

			function shauxin() {
				if(mui.os.plus) {
					mui.plusReady(function() {
						setTimeout(function() {
							window.location.reload;
							mui('#offCanvasContentScroll').pullRefresh().pullupLoading();
						}, 300);

					});
				} else {
					mui.ready(function() {
						window.location.reload;
						mui('#offCanvasContentScroll').pullRefresh().pullupLoading();
					});
				}
			}
			$(document).on("tap", ".list", function() {
				var obj = {
					"caseuid": "",
					"plancaseuid": "",
					"readingrecorduid": $(this).attr("readingrecorduid")
				}
				common.open("../langdu/readdetails.html", "../langdu/readdetails.html", obj)
			})
		</script>
	</body>

</html>